home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10821 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  947 b 

  1. Path: leopard.wmin.ac.uk!tqaec
  2. From: tqaec@westminster.ac.uk (Renato Araujo)
  3. Newsgroups: comp.lang.c++
  4. Subject: NEWBIE: Returning 0 as refernce
  5. Date: 10 Mar 1996 15:32:04 GMT
  6. Organization: University of Westminster
  7. Message-ID: <4huslk$rpk@badger.wmin.ac.uk>
  8. NNTP-Posting-Host: leopard.wmin.ac.uk
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. I am trying to write bits of Linux in C++. In order to make it fast I try to
  12. return references instead of pointers (some classes are rather big). But what
  13. is the standard way of returning a reference when it is not found
  14.  Let me try to explain for example: a method searchs for an object and
  15. returns if found, when it is not found I thought about returnig a 0, but I get
  16. compilation error ( as expected). My first idea was to overload operator= for 0
  17. so the returned object would be a dummy. But wouldn't it make the method
  18. slower? or is there a better way of doing this?
  19.   Thanking you in advance.
  20. Renato Araujo
  21.  
  22.